<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title></title>
</head>
<body scroll="no">
<div class="col-sm-10 col-sm-offset-1">
    <!-- #section:pages/invoice -->
    <div class="widget-box transparent">
        <div class="widget-header widget-header-large">
            <h3 class="widget-title grey lighter">
                <i class="ace-icon fa fa-leaf green"></i>
                ${schedule.jobGroup}:${schedule.jobName}
            </h3>

            <!-- #section:pages/invoice.info -->
            <!--
            <div class="widget-toolbar no-border invoice-info">
                <span class="invoice-info-label">Cron:</span>
                <span class="red">${schedule.cronExpression}</span>

                <br />
                <span class="invoice-info-label">CreateTime:</span>
                <span class="blue">${schedule.createTime}</span>
            </div>

            <div class="widget-toolbar hidden-480">
                <a href="#">
                    <i class="ace-icon fa fa-print"></i>
                </a>
            </div>
            -->
            <!-- /section:pages/invoice.info -->
        </div>

<div class="widget-body">
    <div class="widget-main padding-24" id="row_containder">
        <!--
<div class="row">
    <div class="col-sm-6">
        <div class="row">
            <div class="col-xs-11 label label-lg label-info arrowed-in arrowed-right">
                <b>Company Info</b>
            </div>
        </div>

        <div class="row">
            <ul class="list-unstyled spaced">
                <li>
                    <i class="ace-icon fa fa-caret-right blue"></i>Street, City
                </li>

                <li>
                    <i class="ace-icon fa fa-caret-right blue"></i>Zip Code
                </li>

                <li>
                    <i class="ace-icon fa fa-caret-right blue"></i>State, Country
                </li>

                <li>
                    <i class="ace-icon fa fa-caret-right blue"></i>
                    Phone:
                    <b class="red">111-111-111</b>
                </li>

                <li class="divider"></li>

                <li>
                    <i class="ace-icon fa fa-caret-right blue"></i>
                    Paymant Info
                </li>
            </ul>
        </div>
    </div>
</div>
-->

        </div>
    </div>
<script>
    $(document).ready(function(){
        initList();
    });
    String.prototype.replaceAll  = function(s1,s2){
        return this.replace(new RegExp(s1,"gm"),s2);
    }
    function initList(){
        $.ajax({
            url:contextPath+'/quartz/getExecutionsBySid.json?scheduleId=${schedule.scheduleId}&page=1&pagesize=50',
            type:'post',
            dataType:'json',
            success:function(data){
                var idx = 1;
                $.each(data,function(i,item) {
                    var arr = [];
                    arr.push("<div class=\"row\">");
                    arr.push("<div class=\"col-sm-12\">");
                    arr.push("<div class=\"row\">");
                    arr.push("<div class=\"col-xs-11 label label-lg label-info arrowed-in arrowed-right\">");
                    arr.push(" <b>" + new Date(item.executeTime).format("yyyy-MM-dd hh:mm:ss") + "</b>");
                    arr.push("</div>");
                    arr.push("</div>");
                    arr.push("<div class=\"row\">");
                    arr.push(" <ul class=\"list-unstyled spaced\">");
                    arr.push("<li> <i class=\"ace-icon fa fa-caret-right blue\"></i>执行结束时间:&nbsp;&nbsp;&nbsp;&nbsp;" + new Date(item.executeEndTime).format("yyyy-MM-dd hh:mm:ss") + " </li>");
                    arr.push("<li><i class=\"ace-icon fa fa-caret-right blue\"></i>执行耗时(S):&nbsp;&nbsp;&nbsp;&nbsp;" + item.executeLength + "</li>");
                    if (item.paramDetail != null && item.paramDetail != '' && item.paramDetail != '{}') {
                        arr.push("<li><i class=\"ace-icon fa fa-caret-right blue\"></i>参数:&nbsp;&nbsp;&nbsp;&nbsp;" + item.paramDetail + "</li>");
                    }
                    var et=item.executeType==1?"按计划执行":"手动执行";
                    arr.push("<li><i class=\"ace-icon fa fa-caret-right blue\"></i>执行方式:&nbsp;&nbsp;&nbsp;&nbsp;"+et+"</li>");
                    var er=item.executeResult==1?"成功":"<b class=\"red\">不成功</b>";
                    arr.push("<li><i class=\"ace-icon fa fa-caret-right blue\"></i>执行结果:&nbsp;&nbsp;&nbsp;&nbsp;"+er+"</li>");
                    //arr.push("<li class=\"divider\"></li>");
                    var rmk= item.remark;
                    rmk=rmk.replaceAll("\r\n","&nbsp;&nbsp;&nbsp;&nbsp;<br>");
                    rmk=rmk.replaceAll("\t","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
                    if(item.executeResult==1){
                        arr.push("<li data-width='100%'><i class=\"ace-icon fa fa-caret-right blue\"></i> 执行结果:<br>&nbsp;&nbsp;&nbsp;&nbsp;"+rmk+"</li>");
                    }else{
                        arr.push("<li data-width='100%'><i class=\"ace-icon fa fa-caret-right blue\"></i> 错误日志:<br>&nbsp;&nbsp;&nbsp;&nbsp;"+rmk+"</li>");
                    }

                    arr.push("</ul>");
                    arr.push("</div>");
                    arr.push("</div><!-- /.col -->");
                    arr.push("</div><!-- /.row -->");
                    arr.push("<div class=\"clearfix\"></div>");
                    arr.push("<div class=\"clearfix\"></div>");
                   $("#row_containder").append(arr.join(''));
                    idx++;
                });
            }
        });
    }
</script>
</body>
</html>
